import { lazy } from 'react';

import LazyImportComponent from '@components/lazyImportComponent/lazyImportComponent';
import {protectedLoader} from "@router/auth.ts";

const routes = [
    {
        path: 'login',
        element: <LazyImportComponent lazyChildren={lazy(() => import('@pages/login'))} />,
    },
    {
        path: '/',
        loader:protectedLoader,
        element: <LazyImportComponent lazyChildren={lazy(() => import('@/layout'))} />,
        children:[
            {
                index:true,
                element :<LazyImportComponent lazyChildren={lazy(() => import('@/pages/home'))}/>
            },
            {
                path:'home',
                element :<LazyImportComponent lazyChildren={lazy(() => import('@/pages/home'))}/>
            },
            {
                path:'tools',
                element :<LazyImportComponent lazyChildren={lazy(() => import('@/pages/tools'))}/>
            },
            {
                path:'manage',
                element :<LazyImportComponent lazyChildren={lazy(() => import('@/pages/manage'))}/>
            },
            {
                path:'workspace',
                element :<LazyImportComponent lazyChildren={lazy(() => import('@/pages/workspace'))}/>
            }
        ]
    },
    {
        path: 'about',
        element: <LazyImportComponent lazyChildren={lazy(() => import('@/pages/notFound'))} />,
    },
    {
        path: '*',
        element: <LazyImportComponent lazyChildren={lazy(() => import('@/pages/notFound'))} />,
    },
];

export default routes;
